package com.one.controller;


import com.one.bo.CourseBo;
import com.one.bo.UserBo;
import com.one.dto.Result;
import com.one.entity.CourseView;
import com.one.entity.SysCollegeEntity;
import com.one.entity.SysCourseEntity;
import com.one.entity.SysUserEntity;
import com.one.service.SysCourseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/course")
public class SysCourseController {

    private final SysCourseService sysCourseService;

    public SysCourseController(SysCourseService sysCourseService) {
        this.sysCourseService = sysCourseService;
    }

    @ApiOperation(value = "添加课程", notes = "添加课程")
    @PostMapping("/addCourse")
    public Result addCourse(@RequestBody SysCourseEntity sysCourseEntity) {
        return sysCourseService.addCourse(sysCourseEntity);
    }

    //根据学院标号和名称查询学院
    @ApiOperation(value = "根据课程标号和名称查询课程", notes = "根据课程标号和名称查询课程")
    @PostMapping("/selectCourse")
    public Result selectCourse(@RequestBody CourseBo courseBo){
        return sysCourseService.selectCourse(courseBo);
    }

    //删除课程
    @ApiOperation(value = "删除课程", notes = "删除课程")
    @PostMapping("/deleteCourse")
    public Result deleteCourse(@RequestBody SysCourseEntity sysCourseEntity) {
        return sysCourseService.deleteCourse(sysCourseEntity);
    }

    @ApiOperation(value = "修改课程信息", notes = "修改课程信息")
    @PostMapping("/updateCourse")
    public Result updateCourse(@RequestBody SysCourseEntity sysCourseEntity) {
        return sysCourseService.updateCourse(sysCourseEntity);
    }
}

